<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>修改密码</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type='text/javascript'
		src='<%=request.getContextPath()%>/dwr/interface/changePwdAction.js'></script>
	<script type='text/javascript'
		src='<%=request.getContextPath()%>/dwr/engine.js'></script>
	<script type='text/javascript'
		src='<%=request.getContextPath()%>/dwr/util.js'></script>
	<script type='text/javascript'>
	String.prototype.trim = function()
	{
		return this.replace(/(^s*)|(s*$)/g, "");
	}
	//校验密码：只能输入1-20个字母、数字、下划线
	function isPswd(s)
	{
		var patrn=/^[a-zA-Z_0-9]{1,20}$/;
		if (!patrn.exec(s)) 
			return false;
		return true;
	}
	//修改密码
	function changePwd(){
		if(!isPswd($("newPwd").value)) {
			$('msg').innerHTML="新密码只能是1-20个字母、数字、下划线";
			return ;
		}
		if($("reNewPwd").value != $("newPwd").value){
			$('msg').innerHTML="两次密码输入不一致";
			return ;
		}
		changePwdAction.changePwd($('oldPwd').value,$('newPwd').value,<%=request.getParameter("sd").toString()%>,function(message){
			$('msg').innerHTML=message;
		});
	}
	//当enter键按下时
	document.onkeydown = function (e){  
	     var theEvent = window.event || e;  
	     var code = theEvent.keyCode || theEvent.which;  
	     if(code == 13){  
	   		changePwd();
	     }  
	}
	
	</script>
	
  </head>
  
  <body >
  <div align="center">
   <label>旧密码</label><input type="password" id="oldPwd" /><br/>
   <label>新密码</label><input type="password" id="newPwd" /><br/>
   <label>再次输入新密码</label><input type= "password" id="reNewPwd" /><br/>
   <label id="msg" style="color:red"></label><br/>
   <input type="button" id="sub" onclick="changePwd()" value="提交" />
  </div>
  </body>
</html>
